<template>
  <div class="color">
    <NavBar title="网易严选" />
    <van-swipe>
      <van-swipe-item class="imge1" v-for="item in goodsdital.skuInfo.skuImageList"><img :src="item.imgUrl"
          alt=""></van-swipe-item>
      <template #indicator="{ active, total }">
        <div class="custom-indicator">{{ active + 1 }}/{{ total }}</div>
      </template>
    </van-swipe>
    <div>
      <div class="price">
        <div class="price-cotent">
          <div class="left">
            <div class="price-top">
              <span>特价</span>
              <span>｜</span>
              <span>
                &nbsp;距离结束
                <van-count-down class="time" :time="time" />
              </span>
            </div>
            <div class="price-bottom">
              <div class="yuan">
                ¥<span>{{ goodsdital.price }}</span>
              </div>

            </div>

          </div>
          <div>
            <img class="right" src="./img/static-union_1678945972c531b5.png" alt="">
          </div>
        </div>
      </div>
      <div class="detailBaseInfo">
        <div class="vip">
          <div>
            <div class="spmcBanner">
              <div class="spmPrice">
                <img src="./img/vip.png" class="viptag" alt="">
                <span class="spmcDesc">
                  Pro会员叠加优惠，再省
                  <span class="spmcEconomizePrice">
                    ¥9
                  </span>
                </span>
              </div>
              <span class="spmBtn">开通</span>
            </div>

          </div>
        </div>
        <div class="baseInfo">
          <div class="info">
            <div class="name">
              {{ goodsdital.skuInfo.skuName }}
            </div>
            <div class="simpleBrandInfo">
              <div class="preLogo1"></div>
              <img class="brandLogo" src="./img/tubiao1.png" alt="">

              <span class="title">网易严选</span>
            </div>
            <div class="desc">
              推荐理由
            </div>
          </div>
          <div class="comment">
            查看评价 >
          </div>
        </div>
        <div class="rcmdBanner">
        </div>


      </div>
      <div class="kong"></div>
      <div class="imge">
        <div class="imge_top">
          <van-cell-group>
            <van-cell title="邮费：满99包邮" is-link />
            <van-cell title="购物返：最高返19积分" is-link />
          </van-cell-group>
        </div>
        <div class="kong"></div>
        <div class="imge_bottom">
          <van-cell-group>
            <van-cell title="请选择规格数量" is-link @click="changeshow2" />
            <van-cell title="限制：该商品不可使用优惠劵" is-link />
            <van-cell is-link @click="changeshow1">
              <template #title>
                <div class="flex1">
                  <span class="custom-title">配送:</span>
                  <span class="custom-title">请选择配送地址</span>
                </div>
              </template>
            </van-cell> <van-cell is-link>
              <template #title>
                <div class="flex1">
                  <span class="custom-title">服务:</span>
                </div>
              </template>
            </van-cell>
          </van-cell-group>
        </div>
      </div>
      <div class="adver">
        <van-swipe class="my-swipe2" :autoplay="3000" indicator-color="white">
          <van-swipe-item>
            <img src="./img/1banner.webp" alt="">
          </van-swipe-item>
          <van-swipe-item>
            <img src="./img/2.banner.webp" alt="">
          </van-swipe-item>

        </van-swipe>
      </div>
      <div class="mbrandInfo">
        <div class="MIfon">
          <div class="infon">
            <div class="left2">
              <img src="./img/3p.png" alt="">
            </div>
            <div class="right2">
              <div class="title2">网易严选</div>
              <div class="title3">
                以“让美好生活触手可及”为初心，网易严选逐步发展成为中国新中产喜爱的生活方式品牌。
              </div>
            </div>
          </div>
        </div>

      </div>
      <div class="kong"></div>
      <div class="wrapper">
        <div class="dt-section-1">
          <div class="m-attCon">
            <div class="tt">
              商品参数
            </div>
            <div class="item" v-for="item in goodsdital.skuInfo.skuAttrValueList">
              <div class="itemleft">
                {{ item.attrName }}
              </div>
              <div class="itemright">
                {{ item.valueName }}
              </div>
            </div>



          </div>
        </div>
      </div>



      <div class="m-commonIssues">

      </div>
    </div>
    <!-- 配送的popup -->
    <van-popup v-model:show="showpeisong" position="bottom" :style="{ height: '50%' }">
      <van-area @confirm="text1" v-model="areanum" title="配送至" :area-list="areaList" />
    </van-popup>
    <!-- 商品的popup -->
    <van-popup v-model:show="showshopdetial" closeable position="bottom" :style="{ height: '50%' }">
      <!-- 商品详情 -->
      <div class="shopcard">
        <div class="info-con">
          <div class="f-fl">
            <img :src="goodsdital.skuInfo.skuImageList[0].imgUrl" alt="">
          </div>
          <div class="r-fl">
            <div class="con">
              <div class="tag">
                <span class="tagspan">特价</span>
              </div>
              <p class="prices1">
                <span>
                  <!-- 商品价格 -->
                  <span>价格：¥ 32.9</span>
                  <span class="nowPrice">¥ 39.9</span>
                </span>
              </p>
              <p class="psku">已选择：<span class="it">
                  请选择规格数量
                </span>
              </p>
            </div>
          </div>
        </div>
        <!-- sku选择 -->
        <div class="mparamSelect">
          <div class="spec-con">
            <div class="part3">
              <div class="u-form" v-for="item in goodsdital.spuSaleAttrList ">
                <div class="t2t1">
                  {{ item.saleAttrName }}
                </div>
                <div class="t2t3" v-for="item1 in item.spuSaleAttrValueList">
                  <van-button color="#333" plain type="primary"> {{ item1.saleAttrValueName }}</van-button>
                </div>
              </div>
            </div>
            <div class="u-form">
              <div class="t2t1">
                数量
              </div>
              <van-stepper v-model="shoptotal" />

            </div>
          </div>


        </div>
      </div>
    </van-popup>

    <footer1 />

  </div>
</template>

<script setup lang="ts">
import NavBar from '@/components/NavBar/index.vue'
import { nextTick, onMounted, ref, watch } from 'vue';
import footer1 from "@/pages/goods/footer/index.vue"
import { areaList } from '@vant/area-data';
import { useRoute } from 'vue-router';
import { reqGoodsDetail } from "@/api/search"
const route = useRoute()
const areanum = ref()
const time = ref(30 * 60 * 60 * 1000)
const showpeisong = ref(false)
const showshopdetial = ref(false)
const changeshow1 = () => {
  showpeisong.value = true
}
const goodsdital = ref(
)
const changeshow2 = () => {
  showshopdetial.value = true
}
const text1 = (e: any) => {
  console.log(e);
}
const shoptotal = ref(1)

const goodsdetial = async (id: number) => {
  try {
    let res = await reqGoodsDetail(id)
    goodsdital.value = res
    console.log(goodsdital.value);
  } catch (error) {
    console.log(error);

  }


}

watch(() => route.query.outeParams, () => {
  console.log(333);
  goodsdetial(route.query.outeParams as unknown as number)

}, {
  immediate: true,
})


</script>

<style lang="less" scoped>
.color {
  background-color: #f4f4f4
}

.custom-indicator {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 2px 5px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.1);

}

.shopcard {
  width: 345px;
  height: 318px;
  padding-bottom: 63px;
  padding-left: 15px;
  padding-right: 15px;
  padding-top: 16.5px;
  box-sizing: border-box;

  .info-con {
    height: 99px;
    margin-bottom: 21px;
    width: 345.2px;

    .f-fl {
      width: 89px;
      height: 99px;
      margin-right: -98px;
      background-color: #f4f4f4;
      float: left;

      img {
        width: 89px;
        height: 99px;
      }
    }

    .r-fl {
      width: 172.262px;
      height: 99px;
      margin-left: 108px;
      display: flex;
      align-items: flex-end;

      .con {
        width: 159px;
        height: 62.6px;
        font-size: 14px;

        .tag {
          display: flex;
          -webkit-box-align: center;
          -ms-flex-align: center;
          align-items: center;
          position: relative;
          display: inline-block;


        }
      }

      .tagspan {
        width: 24px;
        height: 15px;
        color: #fff;
        background-color: #f48f18;
        vertical-align: middle;
        border: 1px solid #f48f18;
        border-radius: 4px;
        padding-left: 4.5px;
        padding-right: 1.5px;
        margin-bottom: 4px;

      }

      .prices1 {

        width: 159px;
        height: 20px;
        padding-bottom: 2px;
        font-size: 14px;
        color: #dd1a21;
        line-height: 20px;
        margin: 0;

        display: block;

        span {
          color: #dd1a21;
          display: inline-block;
        }

        .nowPrice {
          color: #999;
          font-size: 12px;
          text-decoration: line-through;
        }
      }

      .psku {
        width: 159px;
        height: 20px;
        display: block;
        font-size: 14px;
        margin: 0;
        line-height: 20px;
        white-space: nowrap;

      }

      .it {
        margin-right: 5px;
        white-space: nowrap;
        font-size: 14px;
        line-height: 20px;
      }

      .mparamSelect {
        width: 345.2px;
        height: 198px;
        font-size: 14px;

        .spec-con {
          .u-from {}
        }

      }


    }
  }
}


.mbrandInfo {
  width: 375px;
  height: 103px;
  border-bottom: 9.6px;
  background: #fff;

  .MIfon {
    width: 375px;
    height: 88px;
    padding-bottom: 15px;

    .infon {
      display: flex;

      .left2 {
        width: 90px;
        height: 88px;

        img {
          width: 48px;
          height: 48px;
          margin-top: 25px;
          margin-left: 22.5px;
          margin-right: 19.5px;
        }

      }

      .right2 {
        width: 270px;
        height: 88px;
        margin-right: 15px;

        .title2 {
          width: 260px;
          height: 24px;
          font-size: 16px;
          font-weight: 600;
          margin-top: 20px;
          margin-bottom: 8px;
        }

        .title3 {
          width: 270px;
          height: 36px;
          font-size: 12px;
          line-height: 18px;
        }
      }
    }

  }

}

.price {
  height: 74px;
  background: #ed3833;
  color: white;
  display: flex;
  box-sizing: border-box;
}

.price-cotent {
  padding-left: 15px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.left {
  padding-top: 8px;
  font-size: 14px;
  line-height: 21px;
  flex-grow: 1;
  flex-shrink: 1;
  height: 74px;
  font-size: 14px;
  flex: 1;
  height: 100%;
  -webkit-box-flex: 1;
  box-sizing: border-box;
}

.right {
  height: 40px;
  width: 75px;
  margin-right: 0;
  display: inline-block;
  vertical-align: middle;
}

.price-top {
  width: 285px;
  height: 18px;
  box-sizing: border-box;
  margin-bottom: 4px;
}

.time {
  display: inline;
  color: #fff;
}

.price-bottom {
  height: 40px;
  font-weight: 700;
  line-height: 40px;
}

.yuan {
  font-size: 28px;
  display: inline-block;
}

.xian {
  font-weight: 700;
  font-size: 14px;
  display: inline-block;
  margin-left: 2px;
  text-decoration: line-through;

}

.xian ::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  margin: auto;
  color: black;
}

.detailBaseInfo {
  width: 360px;
  height: 239.100px;
  padding-left: 15px;
  padding-top: 13px;
  padding-bottom: 18px;
  background: #fff;
}

.viptag {
  width: 21px;
  height: 12px;
}

.imge_top {}

.spmcDesc {
  box-sizing: border-box;
  color: #333;
  font-size: 12px;
  font-weight: 600;
  line-height: 34px;
  text-size-adjust: 100%;
}

.spmcEconomizePrice {
  box-sizing: border-box;
  color: #dd1a21;
  font-weight: 700;
  font-size: 14px;
  line-height: 19.5px;
  margin-left: 2px;
  text-size-adjust: 100%;

}

.spmcBanner {
  width: 325px;
  display: flex;
  padding-left: 10px;
  padding-right: 10px;
  align-items: center;
  background-color: #fff1d2;
  position: relative;
  justify-content: space-between
}

.vip {
  width: 360px;
  height: 40px;
}

.baseInfo {
  margin-top: 7px;
  width: 360px;
  height: 99.5px;
  display: flex;

  .info {
    width: 259px;
    height: 99.5px;
    padding-right: 12px;

    .name {
      box-sizing: border-box;
      display: block;
      width: 259px;
      height: 48px;
      font-size: 16px;
      font-weight: 700;
      line-height: 24px;
      margin-bottom: 2px;
      color: #333;
      text-size-adjust: 100%;
      overflow: hidden
    }
  }

  .simpleBrandInfo {
    width: 259px;
    height: 28px;
    display: flex;
    font-size: 14px;
    margin-top: 3px;
    margin-bottom: 2.5px;
    align-items: center;

    .preLogo1 {
      width: 32px;
      height: 19px;
      margin-right: 4px;
      background-image: url('./img/ziying.png');
      background-size: 100% 100%;
    }

    .brandLogo {
      width: 14px;
      height: 14px;
    }

    .title {
      color: #7f7f7f;
      width: 48px;
      height: 18px;
      font-size: 12px;
      line-height: 18px;

    }

  }

}

.desc {
  width: 259px;
  height: 18px;
  font-size: 12px;
  color: #333;
  font-weight: 100;
}

.spmBtn {
  font-size: 12px;
  font-weight: 600;
  width: 48px;
  text-align: center;
  height: 24px;
  line-height: 24px;
  padding-left: 12px;
  padding-right: 12px;
  background-color: #12161c;
  color: #f3ca84;
  border-radius: 21px;
  display: block;
  box-sizing: border-box;
}

.comment {
  display: flex;
  font-size: 14px;
  align-items: center;
  box-sizing: border-box;
  justify-content: center;
  line-height: 21px;
  color: rgb(51, 51, 51);
}

.rcmdBanner {
  width: 323.400px;
  height: 58px;
  padding: 7px 10px;
  border: 0.8px;
  margin-top: 6;
  position: relative;
  background: #fafafa;
  border: 1px solid #e6e6e6;
}

.imge {
  width: 375px;
  height: 295.8px;
  border-top: 9.6px;
}

.imge1 {
  width: 375px;
  height: 375px;

  img {
    width: 375px;
    height: 375px;
  }
}

.kong {
  width: 375px;
  border-top: 9.6px;
  height: 9.6px;
}

.rt {
  width: 248px;
  height: 48px;
}

.flex1 {
  display: flex;
  align-items: center;
  position: relative;
}

.adver {}

.my-swipe2 {
  img {
    width: 375px;
    height: 100px;
  }
}

.wrapper {
  .dt-section-1 {
    width: 375px;
    background-color: #fff;

    .m-attCon {
      width: 345px;
      padding: 15px;

      .tt {
        width: 345px;
        height: 46px;
        font-size: 14px;
        padding-top: 20px;
        padding-bottom: 12px;
        vertical-align: center;
      }

      .item {
        padding-top: 5px;
        padding-bottom: 5px;
        padding-left: 15px;
        background-image: linear-gradient(90deg, #919191 33%, hsla(0, 0%, 100%, 0) 0);
        background-position: top;
        background-size: 12px 1px;
        background-repeat: repeat-x;

        .itemleft {
          width: 74px;
          height: 22px;
          position: relative;
          color: #999;
          font-size: 12px;
          line-height: 22px;
          height: 22px;
          float: left;
        }

        .itemright {
          width: 246px;
          height: 22px;
          font-size: 12px;
          line-height: 22px;
          height: 22px;
        }


      }
    }
  }
}

.t2t1 {
  width: 345.2px;
  height: 26px;
  padding-bottom: 6px;
  color: #333;
  font-size: 14px;

}

.t2t3 {
  width: 345px;
  padding-bottom: 10px;
  margin-right: 15px;
  display: inline;

  .t3t4 {
    width: 67.6px;
    height: 36px;
    padding-left: 12px;
    padding-right: 12px;
    margin-left: 15px;
    margin-bottom: 10px;
    border: 1px solid #7f7f7f;
    overflow: hidden;


  }
}
</style>
